<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.8" />
<link rel="Shortcut Icon" href="/images/favicon.ico" type="image/x-icon" />
<title></title>
<link rel="stylesheet" href="asciidoc-2.css" tppabs="http://old.peachfuzzer.com/v2/asciidoc.css" type="text/css" />
<link rel="stylesheet" href="website-2.css" tppabs="http://old.peachfuzzer.com/v2/website.css" type="text/css" />
</head>

<body>

<div id="layout-menu-box">
<div id="layout-menu">
  <div><a href="WhatIsPeach.html" tppabs="http://old.peachfuzzer.com/WhatIsPeach.html">What is Peach</a></div>
  <div><a href="Installation.html" tppabs="http://old.peachfuzzer.com/v3/Installation.html"><b>Installing</b></a></div>
  <div><a href="PeachQuickStart.html" tppabs="http://old.peachfuzzer.com/v3/PeachQuickStart.html"><b>Tutorials</b></a></div>
  <div><a href="Methodology.html" tppabs="http://old.peachfuzzer.com/Methodology.html">Methodology</a></div>
  <div><a href="Introduction.html" tppabs="http://old.peachfuzzer.com/Introduction.html">Introduction</a></div>
  <div><a href="Training.html" tppabs="http://old.peachfuzzer.com/Training.html">Training</a></div>
  <div><a href="javascript:if(confirm(%27http://www.dejavusecurity.com/peach.html  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://www.dejavusecurity.com/peach.html%27" tppabs="http://www.dejavusecurity.com/peach.html">Enterprise</a></div>
  <div><a href="FAQ.html" tppabs="http://old.peachfuzzer.com/v3/FAQ.html">FAQ</a></div>
  <div><a href="javascript:if(confirm(%27http://forums.peachfuzzer.com/forum.php  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://forums.peachfuzzer.com/forum.php%27" tppabs="http://forums.peachfuzzer.com/forum.php">Support Forums</a></div>

  <div><h5>Peach 3</h5></div>
  <div><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="PeachPit.html" tppabs="http://old.peachfuzzer.com/v3/PeachPit.html">Peach Pits</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="GeneralConfiguration.html" tppabs="http://old.peachfuzzer.com/v3/GeneralConfiguration.html">General Conf</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="DataModeling.html" tppabs="http://old.peachfuzzer.com/v3/DataModeling.html">Data Modeling</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="StateModel.html" tppabs="http://old.peachfuzzer.com/v3/StateModel.html">State Modeling</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="AgentsMonitors.html" tppabs="http://old.peachfuzzer.com/v3/AgentsMonitors.html">Agents</a></div>
  <div>&nbsp;&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="AgentsMonitors.html" tppabs="http://old.peachfuzzer.com/v3/AgentsMonitors.html">Monitors</a></div>
  <div>&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="TestConfig.html" tppabs="http://old.peachfuzzer.com/v3/TestConfig.html">Test</a></div>
        <div>&nbsp;&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="Publisher.html" tppabs="http://old.peachfuzzer.com/v3/Publisher.html">Publishers</a></div>
  <div>&nbsp;&nbsp;<img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="Logger.html" tppabs="http://old.peachfuzzer.com/v3/Logger.html">Loggers</a></div>
  <!-- <div>&nbsp;<img src="/images/1.gif" /><a href="/v3/DebuggingPitFiles.html">Debugging Pits</a></div> -->
  <!-- <div>&nbsp;<img src="/images/1.gif" /><a href="/v3/ValidatingPitFiles.html">Validating Pits</a></div> -->
  <div><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="RunningPeach.html" tppabs="http://old.peachfuzzer.com/v3/RunningPeach.html">Running</a></div>
  <!-- <div><img src="/images/1.gif" /><a href="/v3/ParallelPeach.html">Parallel</a></div> -->
  <!-- <div><img src="/images/1.gif" /><a href="/v3/ExtendingPeach.html">Extending</a></div> -->
  <div><img src="1.gif" tppabs="http://old.peachfuzzer.com/images/1.gif" /><a href="minset.html" tppabs="http://old.peachfuzzer.com/v3/minset.html">Minset</a></div>

  <div><h5><a href="peach23.html" tppabs="http://old.peachfuzzer.com/v2/peach23.html">Peach 2.3</a></h5></div>

  <div><hr/></div>

  <div><a href="License.html" tppabs="http://old.peachfuzzer.com/License.html">License</a></div>
</div>
</div>
<div id="layout-content-box">
<div id="layout-banner">
  <div id="layout-title">
    <a href="index.htm" tppabs="http://old.peachfuzzer.com/"><img src="peach_fuzzer.png" tppabs="http://old.peachfuzzer.com/images/peach_fuzzer.png" height="100" /></a>
    <a href="javascript:if(confirm(%27http://www.dejavusecurity.com/peach.html  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://www.dejavusecurity.com/peach.html%27" tppabs="http://www.dejavusecurity.com/peach.html" class="layout-inner-banner-right">
                <img height="50" src="dejavusecurity.png" tppabs="http://old.peachfuzzer.com/images/dejavusecurity.png" /></a>
  </div>

  <div id="layout-description">
  <script>
  (function() {
    var cx = '007028538774543840348:g-0dlrdlmxs';
    var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
    gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//www.google.com/cse/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
  })();
</script>
<gcse:search></gcse:search>
      </div>
</div>
<div id="layout-content">
<div id="content">
<div class="sect1">
<h2 id="_create_a_custom_publisher">Create a Custom Publisher</h2>
<div class="sectionbody">
<div class="paragraph"><p>There are a number of methods available to override from the Parent class, this shows the minimum needed to implement a file writer.  Many other methods are also available to override depending on use.</p></div>
<div class="paragraph"><p>The code you write should live in a <em>.py</em> file in the same folder as your <em>.xml</em> file.  This will make it all much easier to package up.  See the <a href="PythonPath-1.html" tppabs="http://old.peachfuzzer.com/v2/PythonPath.html">PythonPath</a> and <a href="Import-1.html" tppabs="http://old.peachfuzzer.com/v2/Import.html">Import</a> elements for how to include your new code into your Peach XML file.</p></div>
<div class="paragraph"><p><strong>NOTE:</strong> Never add the code into the Peach source folders!  You&#8217;re welcome to submit them as patches, but otherwise keep them in another folder.  This will make it easier to move to another machine, and upgrade Peach in the future.</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #000080">import</span></span> os<span style="color: #990000">,</span> sys<span style="color: #990000">,</span> time
<span style="font-weight: bold"><span style="color: #000080">from</span></span> Peach<span style="color: #990000">.</span>publisher <span style="font-weight: bold"><span style="color: #000080">import</span></span> Publisher

<span style="font-weight: bold"><span style="color: #0000FF">class</span></span> <span style="font-weight: bold"><span style="color: #000000">FileWriter</span></span><span style="color: #990000">(</span>Publisher<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">        '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">        Publishes generated data to a file.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">        '''</span></span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">__init__</span></span><span style="color: #990000">(</span>self<span style="color: #990000">,</span> filename<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @type   filename: string</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  filename: Filename to write to</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>

                <span style="font-style: italic"><span style="color: #9A1900"># Always call the parent init method</span></span>
                Publisher<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">__init__</span></span><span style="color: #990000">(</span>self<span style="color: #990000">)</span>

                self<span style="color: #990000">.</span>_filename <span style="color: #990000">=</span> filename
                self<span style="color: #990000">.</span>_fd <span style="color: #990000">=</span> None
                self<span style="color: #990000">.</span>_state <span style="color: #990000">=</span> <span style="color: #993399">0</span>    <span style="font-style: italic"><span style="color: #9A1900"># 0 - stopped; 1 - started</span></span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">start</span></span><span style="color: #990000">(</span>self<span style="color: #990000">):</span>
                <span style="font-weight: bold"><span style="color: #0000FF">pass</span></span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">connect</span></span><span style="color: #990000">(</span>self<span style="color: #990000">):</span>
                <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> self<span style="color: #990000">.</span>_state <span style="color: #990000">==</span> <span style="color: #993399">1</span><span style="color: #990000">:</span>
                        <span style="font-weight: bold"><span style="color: #0000FF">raise</span></span> <span style="font-weight: bold"><span style="color: #000000">Exception</span></span><span style="color: #990000">(</span><span style="color: #FF0000">'File::start(): Already started!'</span><span style="color: #990000">)</span>

                <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> self<span style="color: #990000">.</span>_fd <span style="color: #990000">!=</span> None<span style="color: #990000">:</span>
                        self<span style="color: #990000">.</span>_fd<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">close</span></span><span style="color: #990000">()</span>

                self<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">mkdir</span></span><span style="color: #990000">()</span>

                self<span style="color: #990000">.</span>_fd <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #000000">open</span></span><span style="color: #990000">(</span>self<span style="color: #990000">.</span>_filename<span style="color: #990000">,</span> <span style="color: #FF0000">"w+b"</span><span style="color: #990000">)</span>
                self<span style="color: #990000">.</span>_state <span style="color: #990000">=</span> <span style="color: #993399">1</span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">stop</span></span><span style="color: #990000">(</span>self<span style="color: #990000">):</span>
                self<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">close</span></span><span style="color: #990000">()</span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">mkdir</span></span><span style="color: #990000">(</span>self<span style="color: #990000">):</span>
                <span style="font-style: italic"><span style="color: #9A1900"># lets try and create the folder this file lives in</span></span>
                delim <span style="color: #990000">=</span> <span style="color: #FF0000">""</span>

                <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> self<span style="color: #990000">.</span>_filename<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">find</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"\\"</span><span style="color: #990000">)</span> <span style="color: #990000">!=</span> <span style="color: #990000">-</span><span style="color: #993399">1</span><span style="color: #990000">:</span>
                        delim <span style="color: #990000">=</span> <span style="color: #FF0000">'\\'</span>
                <span style="font-weight: bold"><span style="color: #0000FF">elif</span></span> self<span style="color: #990000">.</span>_filename<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">find</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"/"</span><span style="color: #990000">)</span> <span style="color: #990000">!=</span> <span style="color: #990000">-</span><span style="color: #993399">1</span><span style="color: #990000">:</span>
                        delim <span style="color: #990000">=</span> <span style="color: #FF0000">'/'</span>
                <span style="font-weight: bold"><span style="color: #0000FF">else</span></span><span style="color: #990000">:</span>
                        <span style="font-weight: bold"><span style="color: #0000FF">return</span></span>

                <span style="font-style: italic"><span style="color: #9A1900"># strip filename</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">try</span></span><span style="color: #990000">:</span>
                        path <span style="color: #990000">=</span> self<span style="color: #990000">.</span>_filename<span style="color: #990000">[:</span> self<span style="color: #990000">.</span>_filename<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">rfind</span></span><span style="color: #990000">(</span>delim<span style="color: #990000">)</span> <span style="color: #990000">]</span>
                        os<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">mkdir</span></span><span style="color: #990000">(</span>path<span style="color: #990000">)</span>
                <span style="font-weight: bold"><span style="color: #0000FF">except</span></span><span style="color: #990000">:</span>
                        <span style="font-weight: bold"><span style="color: #0000FF">pass</span></span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">close</span></span><span style="color: #990000">(</span>self<span style="color: #990000">):</span>
                <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> self<span style="color: #990000">.</span>_state <span style="color: #990000">==</span> <span style="color: #993399">0</span><span style="color: #990000">:</span>
                        <span style="font-weight: bold"><span style="color: #0000FF">return</span></span>

                self<span style="color: #990000">.</span>_fd<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">close</span></span><span style="color: #990000">()</span>
                self<span style="color: #990000">.</span>_fd <span style="color: #990000">=</span> None
                self<span style="color: #990000">.</span>_state <span style="color: #990000">=</span> <span style="color: #993399">0</span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">send</span></span><span style="color: #990000">(</span>self<span style="color: #990000">,</span> data<span style="color: #990000">):</span>
                self<span style="color: #990000">.</span>_fd<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">write</span></span><span style="color: #990000">(</span>data<span style="color: #990000">)</span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">receive</span></span><span style="color: #990000">(</span>self<span style="color: #990000">,</span> size <span style="color: #990000">=</span> None<span style="color: #990000">):</span>
                <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> size <span style="color: #990000">!=</span> None<span style="color: #990000">:</span>
                        <span style="font-weight: bold"><span style="color: #0000FF">return</span></span> self<span style="color: #990000">.</span>_fd<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">read</span></span><span style="color: #990000">(</span>size<span style="color: #990000">)</span>

                <span style="font-weight: bold"><span style="color: #0000FF">return</span></span> self<span style="color: #990000">.</span>_fd<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">read</span></span><span style="color: #990000">()</span></tt></pre></div></div>
<div class="paragraph"><p>This is the parent class.  Override methods as needed.</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.7
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Publisher<span style="color: #990000">:</span>
<span style="font-style: italic"><span style="color: #9A1900">        '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">        The Publisher object(s) implement a way to send and/or receave</span></span>
<span style="font-style: italic"><span style="color: #9A1900">        data by some means.  This could be a TCP connection, a filehandle, or</span></span>
<span style="font-style: italic"><span style="color: #9A1900">        SQL, etc.</span></span>

<span style="font-style: italic"><span style="color: #9A1900">        There are two "types" of publishers, stream based and call based.  This</span></span>
<span style="font-style: italic"><span style="color: #9A1900">        base class supports both types.</span></span>

<span style="font-style: italic"><span style="color: #9A1900">        To support stream based publishing implement everything but "call".</span></span>

<span style="font-style: italic"><span style="color: #9A1900">        To support call based publishing implement start, stop, and call.</span></span>

<span style="font-style: italic"><span style="color: #9A1900">        Note: A publisher can support both stream and call based publishing.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">        '''</span></span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">__init__</span></span><span style="color: #990000">(</span>self<span style="color: #990000">):</span>
                <span style="font-style: italic"><span style="color: #9A1900">#: Indicates which method should be called.</span></span>
                self<span style="color: #990000">.</span>withNode <span style="color: #990000">=</span> False

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">hexPrint</span></span><span style="color: #990000">(</span>self<span style="color: #990000">,</span> src<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                WHen in --debug publishers should output there IO</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                stuffs using hexPrint.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>

                FILTER<span style="color: #990000">=</span><span style="color: #FF0000">''</span><span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">join</span></span><span style="color: #990000">([(</span><span style="font-weight: bold"><span style="color: #000000">len</span></span><span style="color: #990000">(</span><span style="font-weight: bold"><span style="color: #000000">repr</span></span><span style="color: #990000">(</span><span style="font-weight: bold"><span style="color: #000000">chr</span></span><span style="color: #990000">(</span>x<span style="color: #990000">)))==</span><span style="color: #993399">3</span><span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">and</span></span> <span style="font-weight: bold"><span style="color: #000000">chr</span></span><span style="color: #990000">(</span>x<span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">or</span></span> <span style="color: #FF0000">'.'</span> <span style="font-weight: bold"><span style="color: #0000FF">for</span></span> x <span style="font-weight: bold"><span style="color: #0000FF">in</span></span> <span style="font-weight: bold"><span style="color: #000000">range</span></span><span style="color: #990000">(</span><span style="color: #993399">256</span><span style="color: #990000">)])</span>
                N<span style="color: #990000">=</span><span style="color: #993399">0</span><span style="color: #990000">;</span> result<span style="color: #990000">=</span><span style="color: #FF0000">''</span>
                length<span style="color: #990000">=</span><span style="color: #993399">16</span>
                <span style="font-weight: bold"><span style="color: #0000FF">while</span></span> src<span style="color: #990000">:</span>
                        s<span style="color: #990000">,</span>src <span style="color: #990000">=</span> src<span style="color: #990000">[:</span>length<span style="color: #990000">],</span>src<span style="color: #990000">[</span>length<span style="color: #990000">:]</span>
                        hexa <span style="color: #990000">=</span> <span style="color: #FF0000">' '</span><span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">join</span></span><span style="color: #990000">([</span><span style="color: #FF0000">"%02X"</span><span style="color: #990000">%</span><span style="font-weight: bold"><span style="color: #000000">ord</span></span><span style="color: #990000">(</span>x<span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">for</span></span> x <span style="font-weight: bold"><span style="color: #0000FF">in</span></span> s<span style="color: #990000">])</span>
                        s <span style="color: #990000">=</span> s<span style="color: #990000">.</span><span style="font-weight: bold"><span style="color: #000000">translate</span></span><span style="color: #990000">(</span>FILTER<span style="color: #990000">)</span>
                        result <span style="color: #990000">+=</span> <span style="color: #FF0000">"%04X   %-*s   %s\n"</span> <span style="color: #990000">%</span> <span style="color: #990000">(</span>N<span style="color: #990000">,</span> length<span style="color: #990000">*</span><span style="color: #993399">3</span><span style="color: #990000">,</span> hexa<span style="color: #990000">,</span> s<span style="color: #990000">)</span>
                        N<span style="color: #990000">+=</span>length
                <span style="font-weight: bold"><span style="color: #0000FF">print</span></span> result

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">initialize</span></span><span style="color: #990000">(</span>self<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                Called at start of test run.  Called once per &lt;test&gt; section.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">pass</span></span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">finalize</span></span><span style="color: #990000">(</span>self<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                Called at end of test run.  Called once per &lt;test&gt; section.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">pass</span></span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">start</span></span><span style="color: #990000">(</span>self<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                Change state such that send/receave will work.  For Tcp this</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                could be connecting to a remote host</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">pass</span></span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">stop</span></span><span style="color: #990000">(</span>self<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                Change state such that send/receave will not work.  For Tcp this</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                could be closing a connection, for a file it might be closing the</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                file handle.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">pass</span></span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">send</span></span><span style="color: #990000">(</span>self<span style="color: #990000">,</span> data<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                Publish some data</span></span>

<span style="font-style: italic"><span style="color: #9A1900">                @type   data: string</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  data: Data to publish</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">raise</span></span> <span style="font-weight: bold"><span style="color: #000000">PeachException</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"Action 'send' not supported by publisher"</span><span style="color: #990000">)</span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">sendWithNode</span></span><span style="color: #990000">(</span>self<span style="color: #990000">,</span> data<span style="color: #990000">,</span> dataNode<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                Publish some data</span></span>

<span style="font-style: italic"><span style="color: #9A1900">                @type   data: string</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  data: Data to publish</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @type   dataNode: DataElement</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  dataNode: Root of data model that produced data</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">raise</span></span> <span style="font-weight: bold"><span style="color: #000000">PeachException</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"Action 'send' not supported by publisher"</span><span style="color: #990000">)</span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">receive</span></span><span style="color: #990000">(</span>self<span style="color: #990000">,</span> size <span style="color: #990000">=</span> None<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                Receive some data.</span></span>

<span style="font-style: italic"><span style="color: #9A1900">                @type   size: integer</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  size: Number of bytes to return</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @rtype: string</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @return: data received</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">raise</span></span> <span style="font-weight: bold"><span style="color: #000000">PeachException</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"Action 'receive' not supported by publisher"</span><span style="color: #990000">)</span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">call</span></span><span style="color: #990000">(</span>self<span style="color: #990000">,</span> method<span style="color: #990000">,</span> args<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                Call a method using arguments.</span></span>

<span style="font-style: italic"><span style="color: #9A1900">                @type   method: string</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  method: Method to call</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @type   args: Array</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  args: Array of strings as arguments</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @rtype: string</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @return: data returned (if any)</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">raise</span></span> <span style="font-weight: bold"><span style="color: #000000">PeachException</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"Action 'call' not supported by publisher"</span><span style="color: #990000">)</span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">callWithNode</span></span><span style="color: #990000">(</span>self<span style="color: #990000">,</span> method<span style="color: #990000">,</span> args<span style="color: #990000">,</span> argNodes<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                Call a method using arguments.</span></span>

<span style="font-style: italic"><span style="color: #9A1900">                @type   method: string</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  method: Method to call</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @type   args: Array</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  args: Array of strings as arguments</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @type   argNodes: Array</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  argNodes: Array of DataElements</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @rtype: string</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @return: data returned (if any)</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">raise</span></span> <span style="font-weight: bold"><span style="color: #000000">PeachException</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"Action 'call' not supported by publisher"</span><span style="color: #990000">)</span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">property</span></span><span style="color: #990000">(</span>self<span style="color: #990000">,</span> property<span style="color: #990000">,</span> value <span style="color: #990000">=</span> None<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                Get or set property</span></span>

<span style="font-style: italic"><span style="color: #9A1900">                @type   property: string</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  property: Name of method to invoke</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @type   value: object</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  value: Value to set.  If None, return property instead</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">raise</span></span> <span style="font-weight: bold"><span style="color: #000000">PeachException</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"Action 'property' not supported by publisher"</span><span style="color: #990000">)</span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">propertyWithNode</span></span><span style="color: #990000">(</span>self<span style="color: #990000">,</span> property<span style="color: #990000">,</span> value<span style="color: #990000">,</span> valueNode<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                Get or set property</span></span>

<span style="font-style: italic"><span style="color: #9A1900">                @type   property: string</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  property: Name of method to invoke</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @type   value: object</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  value: Value to set.  If None, return property instead</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @type   valueNode: DataElement</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                @param  valueNode: data model root node that produced value.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">raise</span></span> <span style="font-weight: bold"><span style="color: #000000">PeachException</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"Action 'property' not supported by publisher"</span><span style="color: #990000">)</span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">connect</span></span><span style="color: #990000">(</span>self<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                Called to connect or open a connection/file.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>

                <span style="font-weight: bold"><span style="color: #0000FF">raise</span></span> <span style="font-weight: bold"><span style="color: #000000">PeachException</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"Action 'connect' not supported by publisher"</span><span style="color: #990000">)</span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">accept</span></span><span style="color: #990000">(</span>self<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                Accept incoming connection.  Blocks until incoming connection</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                occurs.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>

                <span style="font-weight: bold"><span style="color: #0000FF">raise</span></span> <span style="font-weight: bold"><span style="color: #000000">PeachException</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"Action 'accept' not supported by publisher"</span><span style="color: #990000">)</span>

        <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> <span style="font-weight: bold"><span style="color: #000000">close</span></span><span style="color: #990000">(</span>self<span style="color: #990000">):</span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                Close current stream/connection.</span></span>
<span style="font-style: italic"><span style="color: #9A1900">                '''</span></span>
                <span style="font-weight: bold"><span style="color: #0000FF">raise</span></span> <span style="font-weight: bold"><span style="color: #000000">PeachException</span></span><span style="color: #990000">(</span><span style="color: #FF0000">"Action 'close' not supported by publisher"</span><span style="color: #990000">)</span>
</tt></pre></div></div>
</div>
</div>
</div>
<div id="footnotes"></div>
<div id="footer">
<div id="footer-text">

<table width="100%">
<td><td>
<a href="javascript:if(confirm(%27http://dejavusecurity.com/  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://dejavusecurity.com/%27" tppabs="http://dejavusecurity.com/"><img src="dejavusecurity.png" tppabs="http://old.peachfuzzer.com/images/dejavusecurity.png" height="50"/></a>
</td><td>&nbsp;&nbsp;&nbsp;</td><td>

Copyright (c) <a href="javascript:if(confirm(%27http://dejavusecurity.com/  \n\nThis file was not retrieved by Teleport Ultra, because it is addressed on a domain or path outside the boundaries set for its Starting Address.  \n\nDo you want to open it from the server?%27))window.location=%27http://dejavusecurity.com/%27" tppabs="http://dejavusecurity.com/">Deja vu Security</a> <br/>
Last updated 2014-02-23 21:20:58 PST
</td>
</table>

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-1094513-10']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www/') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</div>
</div>
</div>
</div>
</body>
</html>
